import 'package:dio/dio.dart';
import 'package:shared_preferences/shared_preferences.dart';

///
/// 赵亮
///
/// 自定义拦截器
///
///

class HttpInterceptor extends InterceptorsWrapper{
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) async{
    var sharedPreferences = await SharedPreferences.getInstance();

    options.headers.addAll({'userId':sharedPreferences.getInt('userId')??0,'token':sharedPreferences.getString('token')??''});

    // TODO: implement onRequest
    super.onRequest(options, handler);
  }

}

